<?php


namespace App\Factory;


class CheckImg implements Check
{
    /*
     * 审核图片
     */
    function start($ImgPath){
        $token=(new \App\service\Check())->token();
        $url = 'https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined?access_token=' . $token;
        $img = file_get_contents($ImgPath);
        $img = base64_encode($img);
        $bodys = array(
            'image' => $img
        );
        $res = (new \App\service\Check())->request_post($url, $bodys);

        return json_decode($res,true)['conclusion'];
    }
}
